package org.studiox.graph.persistence.mybatis.tk.dao;

import org.springframework.stereotype.Repository;
import org.studiox.graph.persistence.mybatis.tk.base.BaseGraphDao;
import org.studiox.graph.persistence.mybatis.tk.domain.GraphVertexDO;
import org.studiox.graph.persistence.mybatis.tk.mapper.GraphVertexMapper;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.util.List;

@Repository
public class GraphVertexDao extends BaseGraphDao<GraphVertexDO> {

  @Resource private GraphVertexMapper graphVertexMapper;

  @PostConstruct
  private void init() {
    mapper = graphVertexMapper;
  }

  public Integer getGraphVertexSize() {
    return graphVertexMapper.selectCount(null);
  }

  public List<Long> getGraphVertexIds() {
    return graphVertexMapper.getGraphVertexIds();
  }

  public List<String> getGraphVertexUniqs() {
    return graphVertexMapper.getGraphVertexUniqs();
  }

  public Long getGraphVertexIdByUniq(String uniq) {
    return graphVertexMapper.getGraphVertexIdByUniq(uniq);
  }

  public Long getJanusVertexIdByUniq(String uniq) {
    return graphVertexMapper.getJanusVertexIdByUniq(uniq);
  }

  public GraphVertexDO getGraphVertexDoByUniq(String uniq) {
    return graphVertexMapper.getGraphVertexDoByUniq(uniq);
  }

  public List<GraphVertexDO> getGraphVertexDosByUniqLike(String likeUniqStr) {
    return graphVertexMapper.getGraphVertexDosByUniqLike(likeUniqStr);
  }

  public void updateJanusVertexId(Long id, Long janusVertexId) {
    graphVertexMapper.updateJanusVertexId(id, janusVertexId);
  }

  public void updateNeo4jVertexId(Long id, Long neo4jVertexId) {
    graphVertexMapper.updateNeo4jVertexId(id, neo4jVertexId);
  }

  public void updateNebulaVertexId(Long id, Long nebulaVertexId) {
    graphVertexMapper.updateNebulaVertexId(id, nebulaVertexId);
  }

  public void deleteGraphVertexByDbId(Long dbId) {
    graphVertexMapper.deleteByPrimaryKey(dbId);
  }
}
